TSC-TSPL 指令集:

广泛应用在标签打印机上。SDK 中大约有60多条生成指令的函数。

相关类

类名所在位置功能
PTCommandTSPLPrinterCommand.frameworkTSPL 基础指令
PTDispatcherPrinterDispatch.framework与打印机通讯
PTFunctionTSPLDemo对基础指令封装形成功能
PTTestTSPLDemo测试基础指令或封装后的功能

一个典型的 TSC-TSPL 指令生成流程如下:

16
1
PTPrinterTSC *tsc = [[PTPrinterTSC alloc] init];
2
​
3
[tsc initCMDQueue]; //初始化命令队列(必要)
4
​
5
[tsc setPrintAreaSizeWithWidth:@"100" Height:@"80"];    //设置打印区域
6
[tsc setCLS];   //清除缓冲区
7
[tsc printTexTWithXPos:......]; //打印文本
8
[tsc printBarCodeWith........]; //打印条形码
9
​
10
[tsc sendCMDQueue];//发送队列中的指令到打印机(必要)
11
​
12
// NSArray *cmdQueue = [tsc geenrateCMDQueue];或者生成指令,用其他方式发送打印
13
​
14
/*
15
必须在设置指令前初始化命令队列(initCMDQueue),设置所有指令后发送指令队列(sendCMDQueue)。
16
*/